import zipfile
from pathlib import Path
from typing import List


def create_zip(files: List[Path], zip_path: Path):
    with zipfile.ZipFile(zip_path, "w") as zipf:
        for file in files:
            if file.is_file():
                zipf.write(file, file.name)
            elif file.is_dir():
                for sub in file.rglob('*'):
                    if sub.is_file():
                        # 保持目录结构（以file为根）
                        arcname = str(sub.relative_to(file.parent))
                        zipf.write(sub, arcname)
